package v1

import (
	"gin-blog/model"
	"gin-blog/utils/msg"
	"github.com/gin-gonic/gin"
	"net/http"
)

// Upload 上传文件
func Upload(c *gin.Context) {
	file, fileHeader, _ := c.Request.FormFile("file")
	fileSize := fileHeader.Size
	url, code := model.UploadFile(file, fileSize)
	c.JSON(http.StatusOK, msg.R(code, "url", url))
}
